<?php
error_reporting(E_ALL);

use Phalcon\Mvc\Application;
use Phalcon\Config\Adapter\Ini as ConfigIni;

try {
    define('APP_PATH', realpath('..') . '/');
    
    /**
     * Gọi config
     */
    $config = new ConfigIni(APP_PATH . 'app/config/config.ini');

    /**
     * Gọi functions tự viết
     */
    require APP_PATH . 'app/config/functions.php';
    
    /**
     * Thành phần Auto-loader
     */
    require APP_PATH . 'app/config/loader.php';

    /**
     * Load application services
     */
    require APP_PATH . 'app/config/services.php';
    
    /**
     * Thành phần xử lý request
     */
    $application = new Application($di);
    echo $application->handle()->getContent();

} catch (Exception $e){
    echo $e->getMessage();
}
